const Sequelize = require('sequelize')
const db = require('../db.js')
//把order表的字段映射成对象的属性,封装成Order对象
const Order = db.define(
  'Order',
  {
    id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true },
    //标题
    name: { type: Sequelize.STRING, allowNull: false },
    //概述
    phone: { type: Sequelize.STRING, allowNull: false },
    //装修类型
    type: { type: Sequelize.STRING, allowNull: false },
    //预约时间
    orderDate: { type: Sequelize.DATE, allowNull: false },
    //留言
    message: { type: Sequelize.STRING },
  },
  {
    //是否支持驼峰命名
    underscored: true,
    //Order对象，对应的数据库表
    tableName: 'order',
  }
)
module.exports = Order
